INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_LIBHACKRF libhackrf)

FIND_PATH(
    LIBHACKRF_INCLUDE_DIRS
    NAMES libhackrf/hackrf.h
    HINTS $ENV{LIBHACKRF_DIR}/include
        ${PC_LIBHACKRF_INCLUDEDIR}
    PATHS /usr/local/include
          /usr/include
)

FIND_LIBRARY(
    LIBHACKRF_LIBRARIES
    NAMES hackrf
    HINTS $ENV{LIBHACKRF_DIR}/lib
        ${PC_LIBHACKRF_LIBDIR}
    PATHS /usr/local/lib
          /usr/lib
)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBHACKRF DEFAULT_MSG LIBHACKRF_LIBRARIES LIBHACKRF_INCLUDE_DIRS)
MARK_AS_ADVANCED(LIBHACKRF_LIBRARIES LIBHACKRF_INCLUDE_DIRS)

